<?php

use yii\db\Migration;
use yii\db\Schema;

class m170109_082611_create_product_room extends Migration
{
    public function up()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        // 产品舱房价格信息
        $this->createTable('product_room', [
            "id" =>          Schema::TYPE_PK,
            //"cruise_id" =>   Schema::TYPE_INTEGER.    "(9) NOT NULL  COMMENT '游轮编号'",
            "room_id" =>     Schema::TYPE_INTEGER.    "(9) NOT NULL  COMMENT '房型编号'",
            "price" =>       Schema::TYPE_DECIMAL.    "(10,2) DEFAULT NULL COMMENT '价格'",
            "inside_price" =>Schema::TYPE_DECIMAL.    "(10,2) DEFAULT NULL COMMENT '内部价格(同业)'",
            "user_id" =>     Schema::TYPE_INTEGER.    "(10) DEFAULT '0' COMMENT '管理员编号'",
            "created_at" =>  Schema::TYPE_DATETIME.   " NULL",
            "updated_at" =>  Schema::TYPE_TIMESTAMP.  " NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
        ], $tableOptions);
        $this->createIndex("product_room_id", "product_room", "room_id");




    }

    public function down()
    {
        $this->dropTable('product_room');
        echo "m170109_082611_create_product_room cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
